package com.ftg.learn.day12.datastruct;

/**
 * 学习cas
 *
 * @author 布衣
 */
public class LearnCas {

    int aInt = 13;

    public void buy(int n) throws InterruptedException {
        int t = aInt;
        Thread.sleep(1000);
        System.out.println("经过一段时间");
        if(t == aInt){
            aInt -= n;
            System.out.println("购买成功");
        }else{
            System.out.println("购买失败");
        }
    }

}
